package com.wwdeng.smart.video.adapter

import androidx.recyclerview.widget.RecyclerView
import cn.bingoogolapple.androidcommon.adapter.BGARecyclerViewAdapter
import cn.bingoogolapple.androidcommon.adapter.BGAViewHolderHelper
import com.wwdeng.smart.R
import com.wwdeng.smart.video.event.PlaybackFile
import java.text.SimpleDateFormat
import java.util.Date

/**
 * android
 * @Author：wwdeng
 * @CreateTime：2024/9/16 17:35
 * <pre>
 * 回放适配器
 * </pre>
 */
class VideoLocalAdapter(recyclerView: RecyclerView?) : BGARecyclerViewAdapter<PlaybackFile>(recyclerView, R.layout.item_video_local) {
    override fun setItemChildListener(helper: BGAViewHolderHelper, viewType: Int) {
        helper.setItemChildClickListener(R.id.itemLayout) //点击Item
    }

    override fun fillData(helper: BGAViewHolderHelper, position: Int, model: PlaybackFile) {
        val sdf = SimpleDateFormat("HH:mm:ss")
        val formatStartTime: String = sdf.format(Date(model.start_time * 1000))
        val formatEndTime: String = sdf.format(Date(model.end_time * 1000))

        helper.setText(R.id.textStartTime,formatStartTime)
        helper.setText(R.id.textEndTime,formatEndTime)
    }
}